<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text"  placeholder="员工姓名" id="i1">
<input type="text"  placeholder="员工工资" id="i2">
<input type="text"  placeholder="员工工作" id="i3">
<input type="button" value="添加"  onclick="f()">
<table border="1">
    <caption>员工列表</caption>
    <tr>
        <th>姓名</th><th>工资</th><th>工作</th><!--th 表头 -->
    </tr>

    <script>
        function f() {
          /*创建 tr td*/
            let tr = document.createElement("tr");
            let nametd = document.createElement("td");
            let salarytd = document.createElement("td");
            let jobtd = document.createElement("td");
            /*获取元素放进去*/
            nametd.innerText = i1.value;
            salarytd.innerText = i2.value;
            jobtd.innerText = i3.value;
            /*td放在tr 里*/
            tr.appendChild(nametd);
            tr.appendChild(salarytd);
            tr.appendChild(jobtd);
            /*选择到table*/
            let table = document.querySelector("table");
            /*将tr放在table                                                                                                                                                                                                                                 8*/
            table.append(tr);
        }
    </script>
</table>
</body>
</html>